package com.parp;

import com.parp.menus.AboutScreen;
import com.parp.menus.HelpScreen;
import com.parp.menus.SettingsMenu;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Typeface;
import android.media.AudioManager;
import android.os.Bundle;
import android.view.Display;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.TextView;

public class Parp extends Activity {
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//Set the screen contents
		setContentView(R.layout.main_layout);
		Background BG = (Background)findViewById(R.id.background);
		Display display = getWindowManager().getDefaultDisplay(); 
		int width = display.getWidth();
		int height = display.getHeight();
		BG.setBackground(width, height);
		//Set font for labels
		Typeface tf = Typeface.createFromAsset(getAssets(),
        "fonts/Lobster_1.3.otf");
		TextView tv = (TextView) findViewById(R.id.labelSide);
		tv.setTypeface(tf);
		tv.setTextColor(Color.rgb(200, 50, 0));
		tv = (TextView) findViewById(R.id.labelBottom);
		tv.setTypeface(tf);
		tv.setTextColor(Color.rgb(200, 50, 0));
		
		//Set sound context to media
		setVolumeControlStream(AudioManager.STREAM_MUSIC);
		
//		AdManager.setTestDevices( new String[] {//TODO Sort this crap out
//			AdManager.TEST_EMULATOR, // Android emulator
//			"E83D20734F72FB3108F104ABC0FFC738", // My T-Mobile G1 Test Phone
//		} );
	}
	
	/*
	 * Handle Menu
	 */
	
	//When the menu button is pressed, show the menu
	@Override
	public boolean onCreateOptionsMenu(Menu menu) 
	{
	    MenuInflater inflater = getMenuInflater();
	    inflater.inflate(R.menu.menu, menu);
	    return true;
	}
	//Handles menu item selection
	@Override
	public boolean onOptionsItemSelected(MenuItem item) 
	{
	    // Handle item selection
	    switch (item.getItemId()) 
	    {
	    	case R.id.menu_options:
	    		Intent settings = new Intent(this,SettingsMenu.class);
	    		startActivity(settings);
	    		return true;
	    	case R.id.menu_about:
	    		Intent about = new Intent(this,AboutScreen.class);
	    		startActivity(about);
	    		return true;
	    	case R.id.menu_exit:
	    		finish();
	    		return true;
	    	case R.id.menu_help:
	    		Intent help = new Intent(this,HelpScreen.class);
	    		startActivity(help);
	    		return true;	
	    	default:
	        return super.onOptionsItemSelected(item);
	    }
	}

//	public static float getWidth() {
//		return 480;//width;
//	}
//
//	public static float getHeight() {
//		return 800;//height;
//	}
}